unit UMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DesignTimeForm, RunTimeForm, IniFiles;

type
  TForm0 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form0: TForm0;

implementation

{$R *.dfm}

procedure TForm0.Button1Click(Sender: TObject);
begin
  Form1 := TForm1.Create(nil);
  Form1.ShowModal();
  Form1.Free();
end;

procedure TForm0.Button2Click(Sender: TObject);
begin
  Form2 := TForm2.Create(nil);
  Form2.ShowModal();
  Form2.Free();
end;

procedure TForm0.FormCreate(Sender: TObject);
var
  Ini: TIniFile;
  I: Integer;
  Candidates: TStringList;
begin
  Ini := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'config.ini');
  Candidates := TStringList.Create;
  Ini.ReadSection('CANDIDATES',Candidates);
  ini.EraseSection('COUNTERS');
  for I := 1 to Candidates.Count do
    Ini.WriteInteger('COUNTERS', IntToStr(I), 0);
  Ini.WriteInteger('COUNTERS', 'Invalid', 0);
  Ini.WriteInteger('COUNTERS', 'Total', 0);

end;

end.
